package com.lightjet.macross.base.awf.config;

import org.activiti.engine.impl.interceptor.Command;
import org.activiti.engine.impl.interceptor.CommandContext;
import org.activiti.engine.impl.persistence.entity.ExecutionEntity;
import org.activiti.engine.impl.persistence.entity.ExecutionEntityManager;

/**
 * @author : lijia
 * @version : 1.0 2019-03-18 21:50
 * description :
 */
public class DeleteExecutionCmd implements Command<Void> {

    protected String  executionId;

    public DeleteExecutionCmd(String executionId)
    {
        this.executionId = executionId;
    }

    @Override
    public Void execute(CommandContext commandContext) {
        ExecutionEntityManager executionEntityManager = commandContext.getExecutionEntityManager();
        ExecutionEntity executionEntity = executionEntityManager
                .findById(this.executionId);
        executionEntity.removeVariables();
        executionEntityManager.deleteExecutionAndRelatedData(executionEntity,"forjump",false);
        return null;
    }
}
